package com.xlobo.api.fund.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.xlobo.api.fund.parameter.CreateAccountInfoBean;
import com.xlobo.api.fund.service.CreateAccountInfoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.utils.TestDataManager;

/**
 * 创建资金账户 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_CreateAccountInfo {
	private static CreateAccountInfoBean caccountbean;
	private static CreateAccountInfoCall caccountcall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("创建资金账户");
	}

	@Before
	public void caseUp() {
		caccountbean = new CreateAccountInfoBean();
		caccountcall = new CreateAccountInfoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(caccountcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CreateAccountInfo_001() {
		Logger.start(true,"创建资金账户成功");
		try {
			// "UserId": "65a5c0fe-5181-467d-8520-100ffac66357",
			// "AccountType": 2,
			// "UserName": "sample string 3",
			// "Email": "sample string 4",
			// "Action": 5,
			String uuid = TestDataManager.getRandomUUID().toString();
			Logger.comment("setUserId：" + uuid);
			caccountbean.setUserId(uuid);
			Logger.comment("setAccountType：" + 0);
			caccountbean.setAccountType(0);
			String uname = TestDataManager.getChineseName();
			Logger.comment("setUserName：" + uname);
			caccountbean.setUserName(uname);
			String email = TestDataManager.getEmail();
			Logger.comment("setEmail：" + email);
			caccountbean.setEmail(email);
			Logger.comment("setEmail：" + 0);
			caccountbean.setAction(0);
			caccountcall.setData(caccountbean);
			caccountcall.callService();
			Logger.comment("caccountcall send:" + caccountcall.getEntityString());
			Logger.comment("caccountcall return:" + caccountcall.getReturnData());
			// TODO 验证数据库
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_CreateAccountInfo_002() {
		Logger.start(true,"不输入UserId,创建资金账户失败");
		try {
			// TODO 补全case代码
			org.junit.Assert.fail();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}